<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>字体图标的使用</title>
    <!-- 第一步: 引入字体图标的css -->
    <link rel="stylesheet" href="./css/style.css"> 
    <style>
      .red{
        margin-top: 10px;
        color: red;
      }
    </style>
</head>
<body>
    <!-- 第二步: 使用style.css中的类名 -->
    <div class="icon-headphones red"></div>
    <div class="icon-music red"></div>
    <button id="btn">点击我在下面生成图标</button>
    <div id="targetDiv"></div>
    <script>
      // 点击按钮,给右侧标签添加小图标
      var btn = document.getElementById("btn")
      btn.onclick = function (){
        document.getElementById("targetDiv").className = 'icon-play red'
      }
    </script>
</body>
</html>